/**
 * 注意在header 中只用进行授权不能添加Content-Type    multipart/form-data 参数
 */
function main() {

    debugger
    var input = document.createElement("input");
    input.type = "file";
    // 支持传多个文件
    // input.multiple = "multiple";
    input.click();
    input.onchange = () => {
        var file = input.files[0];
        var formData = new FormData();
        var indexFlag = "0_" + Date.now();
        var indexFlag1 = "1_" + Date.now();
        formData.append(indexFlag, file);
        formData.append(indexFlag1, file.name);

        api.DATA_SOURCE_EXECUTE("741ac3c4-fcd8-4ac1-b1fe-89c29ac4bcdf", "api", [], [{
            indexFlag: indexFlag,
            name: "file",
            type: "FormData",
            valueType: "FILE",
            valueContent: "",
        }, {
            name: "fileName",
            type: "FormData",
            valueType: "STRING",
            valueContent: file.name,
        }], "", formData).then(res => {
            debugger
            console.log(res);
            if (res && !res.hasError) {

            }
        }).catch(err => {
            console.error(err);
        });
    }
}
